function PlotCr3bpFrameCanonical(~,S,u)
S = S';

r12 = 3.84405e5;
%[km]Distance between the Earth and the Moon.

Re = 6378.136 / r12;
%[]Normalized mean equatorial radius of the Earth.

Rm = 1737.000 / r12;
%[]Normalized mean equatorial radius of the Moon.

[xe,ye,ze] = ellipsoid(-u,0,0,Re,Re,Re,100);
%[]Coordinates for the Earth.

[xm,ym,zm] = ellipsoid(1-u,0,0,Rm,Rm,Rm,100);
%[]Coordinates for the Earth.

Rsat = S(1:3,:);
%[]Satellite positions WRT the CM in ECI coordinates.

L1 = [0.83691513, 0];
%[]L1 position WRT the CM in CR3BP coordinates.

L2 = [1.15568216, 0];
%[]L2 position WRT the CM in CR3BP coordinates.

L3 = [-1.00506265, 0];
%[]L3 position WRT the CM in CR3BP coordinates.

L4 = [(0.5 - u), sqrt(3) / 2];
%[]L4 position WRT the CM in CR3BP coordinates.

L5 = [(0.5 - u), -sqrt(3) / 2];
%[]L5 position WRT the CM in CR3BP coordinates.

Earth = imread('Earth.bmp');
%[]Loads the image of the Earth.

Moon = imread('Moon.bmp');
%[]Loads the image of the Moon.

ScreenSize = get(0,'ScreenSize');
%[]Determines the location and dimensions of the current monitor.

Window = figure( ...
    'Color','w', ...
    'Name','CIRCULAR RESTRICTED THREE-BODY PROBLEM', ...
    'NumberTitle','Off', ...
    'OuterPosition',ScreenSize);
%[]Opens a new window and adjusts its properties.
n = size(Rsat,2);
%[]Number of points that will be plotted.
rsat = zeros(1,n);
%[]Allocates memory for the range vector.
for k = 1:n
    
    rsat(k) = norm(Rsat(:,k));
    %[Earth radii]Current range.
    
end
a = max(rsat);
if a < 1.2
    Extent = 1.2;
else
    Extent = ceil(max(rsat));
end
%[]Axes extents.

Axes = axes(...
'CameraPosition',Extent*[1,1,1], ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'NextPlot','Add', ...
    'Parent',Window, ...
    'PlotBoxAspectRatio',[1,1,1], ...
    'XGrid','On', ...
    'YGrid','On', ...
    'ZGrid','On',...
    'XLim',Extent*[-1,1], ...
    'YLim',Extent*[-1,1], ...
    'ZLim',Extent*[-1,1], ...
    'XTick',Extent*(-1:0.2:1), ...
    'YTick',Extent*(-1:0.2:1), ...
    'ZTick',Extent*(-1:0.2:1));
%[]Adds an axes to the specified window and adjusts its properties.

surface(xe,ye,-ze, ...
    'CData',Earth, ...
    'EdgeColor','None', ...
    'FaceColor','TextureMap', ...
    'Parent',Axes);
%[]Adds a plot to the specified axes and adjusts its properties.

surface(xm,ym,-zm, ...
    'CData',Moon, ...
    'EdgeColor','None', ...
    'FaceColor','TextureMap', ...
    'Parent',Axes);
%[]Adds a plot to the specified axes and adjusts its properties.

plot3(Rsat(1,:),Rsat(2,:),Rsat(3,:), ...
    'Color','k', ...
    'LineStyle','none', ...
    'Marker','.', ...
    'MarkerSize',8,...
    'Parent',Axes);
%[]Adds a plot to the specified window and adjusts its properties.

plot(L1(1),L1(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',15, ...
    'Parent',Axes);
%[]Plots the position of L1 and adjusts its properties.

plot(L2(1),L2(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',15, ...
    'Parent',Axes);
%[]Plots the position of L2 and adjusts its properties.

plot(L3(1),L3(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',15, ...
    'Parent',Axes);
%[]Plots the position of L3 and adjusts its properties.

plot(L4(1),L4(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',15, ...
    'Parent',Axes);
%[]Plots the position of L4 and adjusts its properties.

plot(L5(1),L5(2), ...
    'Color','k', ...
    'LineStyle','None', ...
    'Marker','.', ...
    'MarkerSize',15, ...
    'Parent',Axes);
%[]Plots the position of L5 and adjusts its properties.

title( ...
    'SATELLITE ORBIT IN THE CR3BP', ...
    'FontSize',20, ...
    'Parent',Axes);
%[]Adds a title to the specified axes and adjusts its properties.

xlabel( ...
    '\chi_x', ...
    'FontSize',16, ...
    'Parent',Axes);
%[]Adds a label to the specified x-axis and adjusts its properties.

ylabel( ...
    '\chi_y', ...
    'FontSize',16, ...
    'Parent',Axes);
%[]Adds a label to the specified y-axis and adjusts its properties.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L1(1),-0.1], ...
    'String','L_1');
%[]Adds a textbox to the specified axes.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L2(1),-0.1], ...
    'String','L_2');
%[]Adds a textbox to the specified axes.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L3(1),-0.1], ...
    'String','L_3');
%[]Adds a textbox to the specified axes.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L4(1),L4(2) + 0.1], ...
    'String','L_4');
%[]Adds a textbox to the specified axes.

text( ...
    'FontName','Arial', ...
    'FontSize',12, ...
    'FontWeight','Bold', ...
    'HorizontalAlignment','Center', ...
    'Parent',Axes, ...
    'Position',[L5(1),L5(2) - 0.1], ...
    'String','L_5');
%[]Adds a textbox to the specified axes.

end
%===================================================================================================